package com.ccl.keyassistant.adapter;

import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/*
 *项目名     keyassistant
 *包名       com.ccl.keyassistant.adapter
 *文件名     GuideViewPagerAdapyer
 *创建者     ccl
 *创建时间   2019-03-08 12:16
 *注解       GuideActivity类的viewpager数据适配器
 */

public class GuideViewPagerAdapyer extends PagerAdapter {

    private List<View> mDatas;

    public GuideViewPagerAdapyer(List<View> datas) {
        this.mDatas = datas;
    }

    @NonNull
    @Override
    public Object instantiateItem(@NonNull ViewGroup container, int position) {
        View view = mDatas.get(position);
        container.addView(view);
        return view;
    }


    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        container.removeView(mDatas.get(position));
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
        return view == object;
    }


}
